package routers

import (
	"xwaf_admin/controllers"
	"xwaf_admin/xadmin"

	beego "github.com/beego/beego/v2/server/web"
)

func init() {
	admin.Run()

	//beego.Router("/public/u/Sendsms", &controllers.SmsController{}, "*:Sendsms") //发送验证码
	//beego.Router("/Index", &controllers.UcenterController{}, "*:Index") //登录后的首页
	//xwaf
	beego.Router("/xwaf/app/v1/List", &controllers.WafappController{}, "*:List")
	beego.Router("/xwaf/app/v1/Add", &controllers.WafappController{}, "*:Add")
	//beego.Router("/xwaf/app/v1/Update", &controllers.WafappController{}, "*:Update")
	beego.Router("/xwaf/app/v1/Del", &controllers.WafappController{}, "*:Del")
	beego.Router("/xwaf/app/v1/Edit", &controllers.WafappController{}, "*:Edit")
	//beego.Router("/xwaf/app/v1/ApplyConfig", &controllers.WafappController{}, "*:ApplyConfig")

	beego.Router("/api/config/v1/GetConfig", &controllers.WafconfigController{}, "*:GetConfig")                  //for nginx
	beego.Router("/xwaf/config/v1/GetReqlimitConfig", &controllers.WafconfigController{}, "*:GetReqlimitConfig") //for reqlimit_rule.html
	beego.Router("/xwaf/config/v1/GetWafConfig", &controllers.WafconfigController{}, "*:GetWafConfig")           //for waf_config.html
	beego.Router("/xwaf/config/v1/GetOtherConfig", &controllers.WafconfigController{}, "*:GetOtherConfig")       //for waf_config_other.html
	beego.Router("/api/config/v1/Version", &controllers.WafconfigController{}, "*:Version")
	//beego.Router("/xwaf/config/v1/UpdateLimitHtml", &controllers.WafconfigController{}, "*:UpdateLimitHtml")
	//beego.Router("/xwaf/config/v1/UpdateWafModel", &controllers.WafconfigController{}, "*:UpdateWafModel")
	beego.Router("/xwaf/config/v1/Update", &controllers.WafconfigController{}, "*:Update")

	beego.Router("/xwaf/config/v1/EditWafConfig", &controllers.WafconfigController{}, "*:EditWafConfig")
	//beego.Router("/xwaf/config/v1/EditReqlimitConfig", &controllers.WafconfigController{}, "*:EditReqlimitConfig") //暂未用上
	//beego.Router("/xwaf/config/v1/UpdateReqlimitConfig", &controllers.WafconfigController{}, "*:UpdateReqlimitConfig")

	beego.Router("/xwaf/rule/v1/List", &controllers.WafRuleController{}, "*:List")
	beego.Router("/api/rule/v1/GetList", &controllers.WafRuleController{}, "*:GetList")
	beego.Router("/xwaf/rule/v1/Add", &controllers.WafRuleController{}, "*:Add")
	//beego.Router("/xwaf/rule/v1/Update", &controllers.WafRuleController{}, "*:Update")
	beego.Router("/xwaf/rule/v1/Edit", &controllers.WafRuleController{}, "*:Edit")
	beego.Router("/xwaf/rule/v1/Del", &controllers.WafRuleController{}, "*:Del")

	//自定义规则
	beego.Router("/xwaf/reqlimit/rule/Add", &controllers.ReqLimitRuleController{}, "*:Add")
	beego.Router("/xwaf/reqlimit/rule/List", &controllers.ReqLimitRuleController{}, "*:List")
	beego.Router("/xwaf/reqlimit/rule/Edit", &controllers.ReqLimitRuleController{}, "*:Edit")
	beego.Router("/xwaf/reqlimit/rule/Del", &controllers.ReqLimitRuleController{}, "*:Del")

	beego.Router("/xwaf/reqlimit/white/List", &controllers.RwlController{}, "*:List")
	beego.Router("/xwaf/reqlimit/white/Add", &controllers.RwlController{}, "*:Add")
	beego.Router("/xwaf/reqlimit/white/Edit", &controllers.RwlController{}, "*:Edit")
	beego.Router("/xwaf/reqlimit/white/Del", &controllers.RwlController{}, "*:Del")

	//urldeny
	beego.Router("/xwaf/urldeny/v1/List", &controllers.WafUrlDenyController{}, "*:List")
	beego.Router("/xwaf/urldeny/v1/Add", &controllers.WafUrlDenyController{}, "*:Add")
	beego.Router("/xwaf/urldeny/v1/Edit", &controllers.WafUrlDenyController{}, "*:Edit")
	beego.Router("/xwaf/urldeny/v1/Del", &controllers.WafUrlDenyController{}, "*:Del")

	//增强型IP黑名单
	beego.Router("/xwaf/blackip/v1/List", &controllers.WafBlackIpController{}, "*:List")
	beego.Router("/api/blackip/v1/Iplist", &controllers.WafBlackIpController{}, "*:Iplist")
	beego.Router("/xwaf/blackip/v1/Add", &controllers.WafBlackIpController{}, "*:Add")
	beego.Router("/xwaf/blackip/v1/Edit", &controllers.WafBlackIpController{}, "*:Edit")
	beego.Router("/xwaf/blackip/v1/Del", &controllers.WafBlackIpController{}, "*:Del")
	beego.Router("/xwaf/blackip/v1/DisableExpireIp", &controllers.WafBlackIpController{}, "*:DisableExpireIp") //定时执行将有设置过期时间的IP计算是否过期，并置为允许状态，从黑名单剔除
	beego.Router("/xwaf/blackip/v1/JudgeWhiteListIp", &controllers.WafBlackIpController{}, "*:JudgeWhiteListIp")

	//ip情报库
	beego.Router("/xwaf/riskip/v1/List", &controllers.WafRiskIpController{}, "*:List")
	beego.Router("/api/riskip/v1/Iplist", &controllers.WafRiskIpController{}, "*:Iplist")
	beego.Router("/xwaf/riskip/v1/Add", &controllers.WafRiskIpController{}, "*:Add")
	beego.Router("/xwaf/riskip/v1/Edit", &controllers.WafRiskIpController{}, "*:Edit")
	beego.Router("/xwaf/riskip/v1/Del", &controllers.WafRiskIpController{}, "*:Del")
	beego.Router("/xwaf/riskip/v1/UpdateCityByIp", &controllers.WafRiskIpController{}, "*:UpdateCityByIp") //临时更新城市信息

	//wiki
	beego.Router("/wiki/v1/List", &controllers.WikiController{}, "*:List")
	beego.Router("/wiki/v1/Add", &controllers.WikiController{}, "*:Add")
	beego.Router("/wiki/v1/Update", &controllers.WikiController{}, "*:Update")
	beego.Router("/wiki/v1/Del", &controllers.WikiController{}, "*:Del")
	beego.Router("/wiki/v1/Read", &controllers.WikiController{}, "*:Read")
	beego.Router("/wiki/v1/ReadEncry", &controllers.WikiController{}, "*:ReadEncry")

	beego.Router("/metric/v1/GetIp", &controllers.MetricController{}, "*:GetIp")
	beego.Router("/metric/v3/V3Line", &controllers.MetricController{}, "*:V3Line")
	beego.Router("/metric/v2/V2Dist", &controllers.MetricController{}, "*:V2Dist")
	beego.Router("/metric/v1/V1Bar", &controllers.MetricController{}, "*:V1Bar")
	beego.Router("/metric/v2/V2Bar", &controllers.MetricController{}, "*:V2Bar")
	beego.Router("/metric/v1/ChinaMap", &controllers.MetricController{}, "*:ChinaMap")
	beego.Router("/metric/v1/V1Line", &controllers.MetricController{}, "*:V1Line")
	beego.Router("/metric/v1/DumpLog", &controllers.MetricController{}, "*:DumpLog")
}
